home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Purity / Purity #34 (1994-08)(Diesel)(DE)[WB].zip / Purity #34 (1994-08)(Diesel)(DE)[WB].adf / IncludesPCQ / DOS.i next >
Text File  |  1994-08-06  |  15KB  |  506 lines

  1. {
  2.         DOS.i for PCQ Pascal
  3.  
  4.         Standard C header for AmigaDOS
  5. }
  6.  
  7. {$I   "Include:Exec/Types.i"}
  8.  
  9. Const
  10.  
  11.     DOSNAME     = "dos.library";
  12.  
  13. { Predefined Amiga DOS global constants }
  14.  
  15.     DOSTRUE     = -1;
  16.     DOSFALSE    = 0;
  17.  
  18. { Mode parameter to Open() }
  19.  
  20.     MODE_OLDFILE        = 1005;         { Open existing file read/write
  21.                                           positioned at beginning of file. }
  22.     MODE_NEWFILE        = 1006;         { Open freshly created file (delete
  23.                                           old file) read/write }
  24.     MODE_READWRITE      = 1004;         { Open old file w/exclusive lock }
  25.  
  26. { Relative position to Seek() }
  27.  
  28.     OFFSET_BEGINNING    = -1;           { relative to Begining Of File }
  29.     OFFSET_CURRENT      = 0;            { relative to Current file position }
  30.     OFFSET_END          = 1;            { relative to End Of File }
  31.  
  32.     BITSPERBYTE         = 8;
  33.     BYTESPERLONG        = 4;
  34.     BITSPERLONG         = 32;
  35.     MAXINT              = $7FFFFFFF;
  36.     MININT              = $80000000;
  37.  
  38. { Passed as type to Lock() }
  39.  
  40.     SHARED_LOCK         = -2;           { File is readable by others }
  41.     ACCESS_READ         = -2;           { Synonym }
  42.     EXCLUSIVE_LOCK      = -1;           { No other access allowed }
  43.     ACCESS_WRITE        = -1;           { Synonym }
  44.  
  45. Type
  46.  
  47.     FileHandle  = Address;
  48.     FileLock    = Address;
  49.  
  50.     DateStampRec = record
  51.         ds_Days         : Integer;      { Number of days since Jan. 1, 1978 }
  52.         ds_Minute       : Integer;      { Number of minutes past midnight }
  53.         ds_Tick         : Integer;      { Number of ticks past minute }
  54.     end;
  55.     DateStampPtr = ^DateStampRec;
  56.  
  57. Const
  58.  
  59.     TICKS_PER_SECOND    = 50;           { Number of ticks in one second }
  60.  
  61. Type
  62.  
  63. { Returned by Examine() and ExInfo(), must be on a 4 byte boundary }
  64.  
  65.     FileInfoBlock = record
  66.         fib_DiskKey     : Integer;
  67.         fib_DirEntryType : Integer;
  68.                         { Type of Directory. If < 0, then a plain file.
  69.                           If > 0 a directory }
  70.         fib_FileName    : Array [0..107] of Char;
  71.                         { Null terminated. Max 30 chars used for now }
  72.         fib_Protection  : Integer;
  73.                         { bit mask of protection, rwxd are 3-0. }
  74.         fib_EntryType   : Integer;
  75.         fib_Size        : Integer;      { Number of bytes in file }
  76.         fib_NumBlocks   : Integer;      { Number of blocks in file }
  77.         fib_Date        : DateStampRec; { Date file last changed }
  78.         fib_Comment     : Array [0..79] of Char;
  79.                         { Null terminated comment associated with file }
  80.         fib_Reserved    : Array [0..35] of Char;
  81.     end;
  82.     FileInfoBlockPtr = ^FileInfoBlock;
  83.  
  84.  
  85. Const
  86.  
  87. { FIB stands for FileInfoBlock }
  88.  
  89. { FIBB are bit definitions, FIBF are field definitions }
  90.  
  91.     FIBB_SCRIPT         = 6;    { program is a script (execute) file }
  92.     FIBB_PURE           = 5;    { program is reentrant and rexecutable}
  93.     FIBB_ARCHIVE        = 4;    { cleared whenever file is changed }
  94.     FIBB_READ           = 3;    { ignored by old filesystem }
  95.     FIBB_WRITE          = 2;    { ignored by old filesystem }
  96.     FIBB_EXECUTE        = 1;    { ignored by system, used by Shell }
  97.     FIBB_DELETE         = 0;    { prevent file from being deleted }
  98.     FIBF_SCRIPT         = 64;
  99.     FIBF_PURE           = 32;
  100.     FIBF_ARCHIVE        = 16;
  101.     FIBF_READ           = 8;
  102.     FIBF_WRITE          = 4;
  103.     FIBF_EXECUTE        = 2;
  104.     FIBF_DELETE         = 1;
  105.  
  106.  
  107. Type
  108.  
  109. { returned by Info(), must be on a 4 byte boundary }
  110.  
  111.     InfoData = record
  112.         id_NumSoftErrors        : Integer;      { number of soft errors on disk }
  113.         id_UnitNumber           : Integer;      { Which unit disk is (was) mounted on }
  114.         id_DiskState            : Integer;      { See defines below }
  115.         id_NumBlocks            : Integer;      { Number of blocks on disk }
  116.         id_NumBlocksUsed        : Integer;      { Number of block in use }
  117.         id_BytesPerBlock        : Integer;
  118.         id_DiskType             : Integer;      { Disk Type code }
  119.         id_VolumeNode           : BPTR;         { BCPL pointer to volume node }
  120.         id_InUse                : Integer;      { Flag, zero if not in use }
  121.     end;
  122.     InfoDataPtr = ^InfoData;
  123.  
  124. Const
  125.  
  126. { ID stands for InfoData }
  127.  
  128.         { Disk states }
  129.  
  130.     ID_WRITE_PROTECTED  = 80;   { Disk is write protected }
  131.     ID_VALIDATING       = 81;   { Disk is currently being validated }
  132.     ID_VALIDATED        = 82;   { Disk is consistent and writeable }
  133.  
  134. CONST
  135.  ID_NO_DISK_PRESENT     = -1;
  136.  ID_UNREADABLE_DISK     = $42414400;   { 'BAD\0' }
  137.  ID_DOS_DISK            = $444F5300;   { 'DOS\0' }
  138.  ID_FFS_DISK            = $444F5301;   { 'DOS\1' }
  139.  ID_NOT_REALLY_DOS      = $4E444F53;   { 'NDOS'  }
  140.  ID_KICKSTART_DISK      = $4B49434B;   { 'KICK'  }
  141.  ID_MSDOS_DISK          = $4d534400;   { 'MSD\0' }
  142.  
  143. { Errors from IoErr(), etc. }
  144.  ERROR_NO_FREE_STORE              = 103;
  145.  ERROR_TASK_TABLE_FULL            = 105;
  146.  ERROR_BAD_TEMPLATE               = 114;
  147.  ERROR_BAD_NUMBER                 = 115;
  148.  ERROR_REQUIRED_ARG_MISSING       = 116;
  149.  ERROR_KEY_NEEDS_ARG              = 117;
  150.  ERROR_TOO_MANY_ARGS              = 118;
  151.  ERROR_UNMATCHED_QUOTES           = 119;
  152.  ERROR_LINE_TOO_LONG              = 120;
  153.  ERROR_FILE_NOT_OBJECT            = 121;
  154.  ERROR_INVALID_RESIDENT_LIBRARY   = 122;
  155.  ERROR_NO_DEFAULT_DIR             = 201;
  156.  ERROR_OBJECT_IN_USE              = 202;
  157.  ERROR_OBJECT_EXISTS              = 203;
  158.  ERROR_DIR_NOT_FOUND              = 204;
  159.  ERROR_OBJECT_NOT_FOUND           = 205;
  160.  ERROR_BAD_STREAM_NAME            = 206;
  161.  ERROR_OBJECT_TOO_LARGE           = 207;
  162.  ERROR_ACTION_NOT_KNOWN           = 209;
  163.  ERROR_INVALID_COMPONENT_NAME     = 210;
  164.  ERROR_INVALID_LOCK               = 211;
  165.  ERROR_OBJECT_WRONG_TYPE          = 212;
  166.  ERROR_DISK_NOT_VALIDATED         = 213;
  167.  ERROR_DISK_WRITE_PROTECTED       = 214;
  168.  ERROR_RENAME_ACROSS_DEVICES      = 215;
  169.  ERROR_DIRECTORY_NOT_EMPTY        = 216;
  170.  ERROR_TOO_MANY_LEVELS            = 217;
  171.  ERROR_DEVICE_NOT_MOUNTED         = 218;
  172.  ERROR_SEEK_ERROR                 = 219;
  173.  ERROR_COMMENT_TOO_BIG            = 220;
  174.  ERROR_DISK_FULL                  = 221;
  175.  ERROR_DELETE_PROTECTED           = 222;
  176.  ERROR_WRITE_PROTECTED            = 223;
  177.  ERROR_READ_PROTECTED             = 224;
  178.  ERROR_NOT_A_DOS_DISK             = 225;
  179.  ERROR_NO_DISK                    = 226;
  180.  ERROR_NO_MORE_ENTRIES            = 232;
  181. { added for 1.4 }
  182.  ERROR_IS_SOFT_LINK               = 233;
  183.  ERROR_OBJECT_LINKED              = 234;
  184.  ERROR_BAD_HUNK                   = 235;
  185.  ERROR_NOT_IMPLEMENTED            = 236;
  186.  ERROR_RECORD_NOT_LOCKED          = 240;
  187.  ERROR_LOCK_COLLISION             = 241;
  188.  ERROR_LOCK_TIMEOUT               = 242;
  189.  ERROR_UNLOCK_ERROR               = 243;
  190.  
  191. { error codes 303-305 are defined in dosasl.h }
  192.  
  193. { Values returned by SameLock() }
  194.  LOCK_SAME             =  0;
  195.  LOCK_SAME_HANDLER     =  1;       { actually same volume }
  196.  LOCK_DIFFERENT        =  -1;
  197.  
  198. { types for ChangeMode() }
  199.  CHANGE_LOCK    = 0;
  200.  CHANGE_FH      = 1;
  201.  
  202. { Values for MakeLink() }
  203.  LINK_HARD      = 0;
  204.  LINK_SOFT      = 1;       { softlinks are not fully supported yet }
  205.  
  206. { values returned by ReadItem }
  207.  ITEM_EQUAL     = -2;              { "=" Symbol }
  208.  ITEM_ERROR     = -1;              { error }
  209.  ITEM_NOTHING   = 0;               { *N, ;, endstreamch }
  210.  ITEM_UNQUOTED  = 1;               { unquoted item }
  211.  ITEM_QUOTED    = 2;               { quoted item }
  212.  
  213. { types for AllocDosObject/FreeDosObject }
  214.  DOS_FILEHANDLE        =  0;       { few people should use this }
  215.  DOS_EXALLCONTROL      =  1;       { Must be used to allocate this! }
  216.  DOS_FIB               =  2;       { useful }
  217.  DOS_STDPKT            =  3;       { for doing packet-level I/O }
  218.  DOS_CLI               =  4;       { for shell-writers, etc }
  219.  DOS_RDARGS            =  5;       { for ReadArgs if you pass it in }
  220.  
  221.  
  222.  
  223. Procedure DOSClose(filehand : FileHandle);
  224.     External;
  225.  
  226. Function CreateDir(name : String) : FileLock;
  227.     External;
  228.  
  229. Function CurrentDir(lock : FileLock) : FileLock;
  230.     External;
  231.  
  232. Procedure DateStamp(var ds : DateStampRec);
  233.     External;
  234.  
  235. Procedure Delay(ticks : Integer);
  236.     External;
  237.  
  238. Function DeleteFile(name : String) : Boolean;
  239.     External;
  240.  
  241. Function DupLock(lock : FileLock) : FileLock;
  242.     External;
  243.  
  244. Function Examine(lock : FileLock; info : FileInfoBlockPtr) : Boolean;
  245.     External;
  246.  
  247. Function Execute(command : String; InFile, OutFile : FileHandle) : Boolean;
  248.     External;
  249.  
  250. Procedure DOSExit(code : Integer);
  251.     External;
  252.  
  253. Function ExNext(lock : FileLock; info : FileInfoBlockPtr) : Boolean;
  254.     External;
  255.  
  256. Function Info(lock : FileLock; params : InfoDataPtr) : Boolean;
  257.     External;
  258.  
  259. Function IoErr : Integer;
  260.     External;
  261.  
  262. Function DOSInput : FileHandle;
  263.     External;
  264.  
  265. Function IsInteractive(f : FileHandle) : Boolean;
  266.     External;
  267.  
  268. Function Lock(name : String; accessmode : Integer) : FileLock;
  269.     External;
  270.  
  271. Function DOSOpen(name : String; accessmode : Integer) : FileHandle;
  272.     External;
  273.  
  274. Function DOSOutput : FileHandle;
  275.     External;
  276.  
  277. Function ParentDir(lock : FileLock) : FileLock;
  278.     External;
  279.  
  280. Function DOSRead(f : FileHandle; buffer : Address; length : Integer) : Integer;
  281.     External;
  282.  
  283. Function Rename(oldname, newname : String) : Boolean;
  284.     External;
  285.  
  286. Function Seek(f : FileHandle; pos : Integer; mode : Integer) : Integer;
  287.     External;
  288.  
  289. Function SetComment(name : String; comment : String) : Boolean;
  290.     External;
  291.  
  292. Function SetProtection(name : String; mask : Integer) : Boolean;
  293.     External;
  294.  
  295. Procedure UnLock(lock : FileLock);
  296.     External;
  297.  
  298. Function WaitForChar(f : FileHandle; timeout : Integer) : Boolean;
  299.     External;
  300.  
  301. Function DOSWrite(f : FileHandle; buffer : Address; len : Integer) : Integer;
  302.     External;
  303.  
  304.  
  305. { OS2.0 }
  306.  
  307. FUNCTION AddBuffers(Name : String; Buffers : Integer) : Boolean;
  308.     External;
  309.  
  310. FUNCTION AddPart(Path1, Path2 : String; Bytes : Integer) : Boolean;
  311.     External;
  312.  
  313. FUNCTION AllocDosObject(ObjectType : Integer; Tags : Address) : Address;
  314.     External;
  315.  
  316. FUNCTION AssignAdd(name : String; Datei : FileLock) : Boolean;
  317.     External;
  318.  
  319. FUNCTION AssignLate(name1, name2 : String) : Boolean;
  320.     External;
  321.  
  322. FUNCTION AssignLock(name : String; Datei : FileLock) : Boolean;
  323.     External;
  324.  
  325. FUNCTION AssignPath(name1, name2 : String) : Boolean;
  326.     External;
  327.  
  328. FUNCTION ChangeMode(Mode : Integer; Datei : Address; newMode : Integer) : Boolean;
  329.     External;                       { Datei is a FileLock OR a FileHandle }
  330.  
  331. FUNCTION CheckSignal(Signal : Integer) : Integer;
  332.     External;
  333.  
  334. FUNCTION CompareDates(First, Second : DateStampPtr) : Integer;
  335.     External;
  336.  
  337. FUNCTION DupLockFromFH(Datei : FileHandle) : FileLock;
  338.     External;
  339.  
  340. FUNCTION ErrorReport(ErrorCode, ReportType : Integer; Param : Address; HandlerID : Address) : Boolean;
  341.     External;                                                          { HandlerID is a MsgPortPtr }
  342.  
  343. FUNCTION ExamineFH(Datei : FileHandle; FIB : FileInfoBlockPtr) : Boolean;
  344.     External;
  345.  
  346. FUNCTION Fault(Code : Integer; Txt : String; VAR Buffer : String; BufferSize : Integer) : Integer;
  347.     External;
  348.  
  349. FUNCTION FGetC(Datei : FileHandle) : Char;
  350.     External;
  351.  
  352. FUNCTION FGets(Datei : FileHandle; VAR Buffer : String; BufferSize : Integer) : String;
  353.     External;
  354.  
  355. FUNCTION FilePart(Path : String) : Char;
  356.     External;
  357.  
  358. FUNCTION Flush(Datei : FileHandle) : Boolean;
  359.     External;
  360.  
  361. FUNCTION Format(drive, name : String; DOSType : Integer) : Boolean;
  362.     External;
  363.  
  364. FUNCTION FPutC(Datei : FileHandle; c : Char) : Integer;
  365.     External;
  366.  
  367. FUNCTION FPuts(Datei : FileHandle; str : String) : Boolean;
  368.     External;
  369.  
  370. FUNCTION FRead(Datei : FileHandle; Buffer : Address; BlockSize, Blocks : Integer) : Integer;
  371.     External;
  372.  
  373. FUNCTION FWrite(Datei : FileHandle; Buffer : Address; BlockSize, Blocks : Integer) : Integer;
  374.     External;
  375.  
  376. PROCEDURE FreeDosObject(ObjectType : Integer; Object : Address);
  377.     External;
  378.  
  379. FUNCTION GetArgStr : String;
  380.     External;
  381.  
  382. FUNCTION GetCurrentDirName(VAR Buffer : String; BufferSize : Integer) : Boolean;
  383.     External;
  384.  
  385. FUNCTION GetProgramDir : FileLock;
  386.     External;
  387.  
  388. FUNCTION GetProgramName(VAR Buffer : String; BufferSize : Integer) : Boolean;
  389.     External;
  390.  
  391. FUNCTION GetPrompt(VAR Buffer : String; BufferSize : Integer) : Boolean;
  392.     External;
  393.  
  394. FUNCTION Inhibit(device : String; mode : Boolean) : Boolean;
  395.     External;
  396.  
  397. FUNCTION IsFileSystem(name : String) : Boolean;
  398.     External;
  399.  
  400. FUNCTION MakeLink(name : String; datei : Address; LinkType : Integer) : Boolean;
  401.     External;                   { LinkType=LINK_HARD : datei=FileLock
  402.                                 { LinkType=LINK_SOFT : Datei=String }
  403.  
  404. FUNCTION NameFromFH(Datei : FileHandle; VAR Buffer : String; BufferSize : Integer) : Boolean;
  405.     External;
  406.  
  407. FUNCTION NameFromLock(Datei : FileLock; VAR Buffer : String; BufferSize : Integer) : Boolean;
  408.     External;
  409.  
  410. FUNCTION OpenFromLock(Datei : FileLock) : FileHandle;
  411.     External;
  412.  
  413. FUNCTION ParentOfFH(Datei : FileHandle) : FileLock;
  414.     External;
  415.  
  416. FUNCTION PathPart(Path : String) : Char;
  417.     External;
  418.  
  419. FUNCTION PrintFault(error : Integer; Str : String) : Boolean;
  420.     External;
  421.  
  422. FUNCTION PutStr(Str : String) : Boolean;
  423.     External;
  424.  
  425. FUNCTION ReadLink(procID : Address; datei : FileLock; name : String;
  426.                   VAR buffer : String; buffersize : Integer) : Boolean;
  427.     External;     { procID is a MsgPortPtr }
  428.  
  429. FUNCTION Relabel(device : String; newname : String) : Boolean;
  430.     External;
  431.  
  432. FUNCTION RemAssignList(name : String; datei : FileLock) : Boolean;
  433.     External;
  434.  
  435. FUNCTION RunCommand(SL : Address; stacksize : Integer; param : String; paramlen : Integer) : Integer;
  436.     External;
  437.  
  438. FUNCTION SameDevice(datei1, datei2 : FileLock) : Boolean;
  439.     External;
  440.  
  441. FUNCTION SameLock(datei1, datei2 : FileLock) : Integer;
  442.     External;
  443.  
  444. FUNCTION SelectInput(new : FileHandle) : FileHandle;
  445.     External;
  446.  
  447. FUNCTION SelectOutput(new : FileHandle) : FileHandle;
  448.     External;
  449.  
  450. FUNCTION SetArgStr(new : String) : String;
  451.     External;
  452.  
  453. FUNCTION SetCurrentDirName(path : String) : Boolean;
  454.     External;
  455.  
  456. FUNCTION SetFileDate(datei : String; date : DateStampPtr) : Boolean;
  457.     External;
  458.  
  459. FUNCTION SetFileSize(datei : FileHandle; new, mode : Integer) : Boolean;
  460.     External;
  461.  
  462. FUNCTION SetIoErr(new : Integer) : Integer;
  463.     External;
  464.  
  465. FUNCTION SetMode(datei : FileHandle; new : Integer) : Boolean;
  466.     External;
  467.  
  468. FUNCTION SetProgramDir(new : FileLock) : FileLock;
  469.     External;
  470.  
  471. FUNCTION SetProgramName(new : String) : Boolean;
  472.     External;
  473.  
  474. FUNCTION SetPrompt(prompt : String) : Boolean;
  475.     External;
  476.  
  477. FUNCTION SetVBuf(datei : FileHandle; VAR Buffer : String; bufmode, buffersize : Integer) : Boolean;
  478.     External;
  479.  
  480. FUNCTION SplitName(path : String; Separator : Char; VAR Buffer : String; start : Short; BufferSize : Integer) : Short;
  481.     External;
  482.  
  483. FUNCTION StrToLong(Str : String; VAR L : Address) : Integer;
  484.     External;
  485.  
  486. FUNCTION SystemTagList(command : String; tags : Address) : Integer;
  487.     External;
  488.  
  489. FUNCTION UnGetC(Datei : FileHandle; c : Integer) : Integer;
  490.     External;
  491.  
  492. FUNCTION VFPrintf(datei : FileHandle; str : String; objects : Address) : Integer;
  493.     External;
  494.  
  495. FUNCTION VFWritef(datei : FileHandle; str : String; objects : Address) : Integer;
  496.     External;
  497.  
  498. FUNCTION VPrintf(str : String; objects : Address) : Integer;
  499.     External;
  500.  
  501. FUNCTION WriteChars(buffer : String; num : Integer) : Integer;
  502.     External;
  503.  
  504.  
  505.  
  506.